<include file="Layout/header" />
<div class="mws-panel grid_5">
    <div class="mws-panel-header">
        <span>添加管理员</span>
    </div>

    <div class="mws-panel-body no-padding">
        <form class="mws-form" action="{:U('User/add')}" id="art_form" method="post" enctype="multipart/form-data">
            <div class="mws-form-inline">

                <div class="mws-form-row">

                    <label class="mws-form-label">用户名</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="username">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">密码</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="password">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">确认密码</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="repassword">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">姓名</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="nikename">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">照片</label>
                    <div class="mws-form-item"  style="width: 266px;">
                        <!-- <div class="fileinput-holder" style="position: relative;"> -->
                        <!-- <span class="fileinput-btn btn" type="button" style="display:block; overflow: hidden; position: absolute;   cursor: pointer;"> -->
                        <!-- 上传图片... -->
                        <input type="file" class="small"  name="images">

                        <input type="hidden" name="image" value="">
                        <!-- </span> -->
                        <!-- </div> -->
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">手机号</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="phone">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">邮箱</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="email">
                    </div>
                </div>

                <div class="mws-form-row">
                    <label class="mws-form-label">性别</label>
                    <div class="mws-form-item clearfix">
                        <ul class="mws-form-list inline">
                            <li>
                                <input type="radio" name="sex" checked  value="男"> 
                                <label> 男</label>
                            </li>
                            <li>
                                <input type="radio" name="sex" value="女"> 
                                <label> 女</label>
                            </li>


                        </ul>
                    </div>

                </div>

            </div>

            <div class="mws-button-row">
                <input type="submit" value="添加" class="btn btn-danger">
                <input type="reset" value="重置" class="btn ">
            </div>
        </form>
    </div>    	
</div>

<div class="mws-panel grid_3" >
    <img src="" style="height: 500px;width: 400px;display: none;"  id="images">  
</div>
<script type="text/javascript">
    $('input[name=images]').change(function () {
        var formData = new FormData($("#art_form")[0]);

        $.ajax({
            url: "{:U('Admin/User/uploadImg')}",
            type: "POST",
            data: formData,
            async: true,
            contentType: false, //必须false才会避开jQuery对 formdata 的默认处理 XMLHttpRequest会对 formdata 进行正确的处理 
            processData: false, //必须false才会自动加上正确的Content-Type
            success: function (data) {
                if (data.status == '1') {
                    // alert(11)
                    $('#images').attr('src', data.path);
                    $('#images').css('display', 'block');
                    $('input[name=image]').val(data.path);

                } else {
                    layer.msg(data.msg);
                }

            }
        });

    })
</script>

<include file="Layout/footer" />